package com.qsd.StudentSystem.controller;

import com.qsd.StudentSystem.service.TeacherService;
import com.qsd.common.enums.ResultStatus;
import com.qsd.common.po.Teacher;
import com.qsd.common.vo.BaseVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

@Slf4j
@Controller
@RequestMapping("teacher")
public class TeacherController {

	@Resource
	private TeacherService teacherService;
	
	@GetMapping("info")
	public ModelAndView info(String username){
		log.info("查询任课老师:{} 详情信息",username);
		ModelAndView modelAndView = new ModelAndView("teacher/info");
		Teacher teacher = teacherService.info(username);
		modelAndView.addObject("teacher", teacher);
		return modelAndView;
	}

	@PostMapping("/file")
	@ResponseBody
	public BaseVo uploadFile(@RequestParam("smfile") MultipartFile multipartFile){
		log.info("头像上传");
		return new BaseVo(ResultStatus.SUCCESS);
	}

}
